# To change this template, choose Tools | Templates
# and open the template in the editor.

import pygame
from pygame.locals import *

from game.state.gamestate import *

class OpenState(GameState):
    def __init__(self, data):
        GameState.__init__(self, data)


    def event(self, evt):
        sd = self.data
        if evt.type == KEYDOWN:
            obj = self.get_dir(evt.key)

            if obj != 0:
                sd.act_mgr.perform("open", sd, sd.main_char.pos(), [obj])
                sd.state_mgr.pop_state()
                return 1
            else:
                if evt.key == K_ESCAPE:
                    sd.state_mgr.pop_state()
                    return 1
        return 1
